<?
//Get page break params
$page_size		= 20;
$page_prefix	= "";
$normal_class	= "page";
$selected_class= "page_current";
$previous		= "<";
$next				= ">";
$first			= "<<";
$last				= ">>";
$break_type		= 1;//"1 => << < 1 2 [3] 4 5 > >>", "2 => < 1 2 [3] 4 5 >", "3 => 1 2 [3] 4 5", "4 => < >"
$url				= $urlType;
$obj_response	= "";
$page_space		= 2;
$page_rewrite	= $con_mod_rewrite;
$db_count		= new db_query("SELECT COUNT(*) AS count
										 FROM categories_multi, products_multi
										 WHERE cat_id = pro_category_id AND cat_type = 'product' AND cat_active = 1 AND pro_active = 1 AND cat_id IN (" . $listCatId . ") AND categories_multi.lang_id = " . $lang_id);
$listing_count	= mysql_fetch_assoc($db_count->result);
$total_record	= $listing_count["count"];
$current_page	= getValue("page", "int", "GET", 1);
if($total_record % $page_size == 0) $num_of_page = $total_record / $page_size;
else $num_of_page = (int)($total_record / $page_size) + 1;
if($current_page > $num_of_page) $current_page = $num_of_page;
if($current_page < 1) $current_page = 1;
$db_count->close();
unset($db_count);
//End get page break params
?>
<div class="temp_1">
	<div class="title_1"><div class="L"><div class="R"><span><?=$rowType["cat_name"]?></span></div></div></div>
	<div class="content product">
		<ul>
		<?
		$db_product	= new db_query("SELECT cat_name, pro_name, pro_id, pro_picture, pro_price
											 FROM categories_multi, products_multi
											 WHERE cat_id = pro_category_id AND cat_type = 'product' AND cat_id IN (" . $listCatId . ") AND cat_active = 1 AND pro_active = 1 AND categories_multi.lang_id = " . $lang_id . "
											 ORDER BY pro_date DESC
											 LIMIT " . ($current_page-1) * $page_size . "," . $page_size);
	 	$i	= 0;
	 	while($row = mysql_fetch_assoc($db_product->result)){
	 		$i++;
	 		$class	= ($i % 4 == 0 ? "last" : "");
	 		if($i % 4 == 1) $class = "first";
	 		$pro_link= generate_detail_url("product", $row["cat_name"], $row["pro_name"], $row["pro_id"]);
	 		$picture	= ($row["pro_picture"] != "" ? $con_root_path . "product_pictures/small_" . $row["pro_picture"] : $fs_imagepath . "no_photo_small.gif");
	 		?>
	 		<li class="<?=$class?>">
	 			<a class="picture" href="<?=$pro_link?>"><img src="<?=$picture?>" /></a>
	 			<div class="break_module_line"></div>
	 			<p class="name"><a href="<?=$pro_link?>"><?=$row["pro_name"]?></a></p>
	 			<p class="price"><?=format_number($row["pro_price"]);?> VND</p>
            <a class="add_to_cart" href="/cart.php?id=<?=$row["pro_id"]?>">Mua ngay</a>
		 	</li>
	 		<?
	 	}
	 	$db_product->close();
	 	unset($db_product);
		?>
		</ul>
	</div>
</div>
<div class="break_module"></div>
<? if($total_record > $page_size){?><div class="page_bar"><?=generatePageBar($page_prefix, $current_page, $page_size, $total_record, $url, $normal_class, $selected_class, $previous, $next, $first, $last, $break_type, $obj_response,$page_space, $page_rewrite);?></div><? }?>